1 /*
2 Copyright: Marcelo S. N. Mancini (Hipreme|MrcSnm), 2018 - 2021
3 License:   [https://creativecommons.org/licenses/by/4.0/|CC BY-4.0 License].
4 Authors: Marcelo S. N. Mancini
5 
6 	Copyright Marcelo S. N. Mancini 2018 - 2021.
7 Distributed under the CC BY-4.0 License.
8    (See accompanying file LICENSE.txt or copy at
9 	https://creativecommons.org/licenses/by/4.0/
10 */
11 module hip.bind.libinfos;
12 import core.stdc.string:strlen;
13 
14 version(Have_bindbc_openal)
15 {
16     import bindbc.openal;
17     string get_audio_devices_list(const ALCchar *devices)
18     {
19         string ret;
20         const(char)* device = devices;
21         const(char)* next = devices + 1;
22         size_t len = 0;
23 
24         ret~= "Devices list:\n";
25         ret~= "----------\n";
26         while (device && *device != '\0' && next && *next != '\0') 
27         {
28             // ret~= device.fromStringz~"\n";
29             // len = strlen(device);
30             // device += (len + 1);
31             // next += (len + 2);
32         }
33         ret~= "----------\n";
34         return ret;
35     }
36 }
37 
38 
39 version(Android)
40 {
41     /** Current OpenSL ES Version*/
42     immutable SLESVersion = "1.0.1";
43 
44     /**
45     * Is feature compatible with...
46     */
47     struct SLESCompatibility
48     {
49         ///Feature compatible with AudioPlayer
50         immutable bool AudioPlayer;
51         ///Feature compatible with AudioRecorder
52         immutable bool AudioRecorder;
53         ///Feature compatible with Engine
54         immutable bool Engine;
55         ///Feature compatible with OutputMix
56         immutable bool OutputMix;
57     }
58 
59     /**
60     *   Documentation for permissions needed on android side when using SLES
61     */
62     enum SLESAndroidRequiredPermissions
63     {
64         ///When using any kind of output mix effect
65         MODIFY_AUDIO_SETTINGS = `<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>`,
66         ///When messing with AudioRecorder
67         RECORD_AUDIO = `<uses-permission android:name="android.permission.RECORD_AUDIO"/>`
68     }
69 
70     /**
71     *   Immutable table on how is compatibility at Android, keeping that only as a reference.
72     */
73     enum Android_NDK_Compatibility : SLESCompatibility
74     {
75         //                                            Player  Rec   Engine Output
76         BassBoost                  = SLESCompatibility(true, false, false, true),
77         BufferQueue                = SLESCompatibility(true, false, false, false),
78         BufferQueueDataLocator     = SLESCompatibility(true, false, false, false), //Source
79         DynamicInterfaceManagement = SLESCompatibility(true, true, true, true),
80         EffectSend                 = SLESCompatibility(true, false, false, false),
81         Engine                     = SLESCompatibility(false, false, true, false),
82         EnvironmentalReverb        = SLESCompatibility(false, false, false, true),
83         Equalize                   = SLESCompatibility(true, false, false, true),
84         IODeviceDataLocator        = SLESCompatibility(false, true, false, false),
85         MetadataExtraction         = SLESCompatibility(true, false, false, false),
86         MuteSolo                   = SLESCompatibility(true, false, false, false),
87         OObject                    = SLESCompatibility(true, true, true, true),
88         OutputMixLocator           = SLESCompatibility(true, false, false, false), //Sink
89         Play                       = SLESCompatibility(true, false, false, false),
90         PlaybackRate               = SLESCompatibility(true, false, false, false),
91         PrefetchStatus             = SLESCompatibility(true, false, false, false),
92         PresetReverb               = SLESCompatibility(false, false, false, true),
93         Record                     = SLESCompatibility(false, true, false, false),
94         Seek                       = SLESCompatibility(true, false, false, false),
95         URIDataLocator             = SLESCompatibility(true, false, false, false), //Source
96         Virtualizer                = SLESCompatibility(true, false, false, true),
97         Volume                     = SLESCompatibility(true, false, false, false)
98         //                                            Player  Rec   Engine Output
99     }
100 }